﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Ordering
{
    public class MyOM2
    {
        #region ShopOM
        public static Shop GetShop(string shopId)
        {
            return MyDAO2.GetShop(shopId);
        }

        public static IList<Shop> GetShops()
        {
            return MyDAO2.GetShops();
        }

        public static void AddShop(Shop shop)
        {
            MyDAO2.AddShop(shop);
        }

        public static void RemoveShop(string shopId)
        {
            MyDAO2.RemoveShop(shopId);
        }

        public static void UpdateShop(Shop shop)
        {
            MyDAO2.UpdateShop(shop);
        }
        #endregion

        #region DishOM
        public static IList<IDictionary<string, string>> GetDishesForMenu(string shopId)
        {
            if (shopId == null || shopId.Equals(""))
                return MyDAO2.GetDishesForMenu();
            else
                return MyDAO2.GetDishesForMenuByShopId(shopId);
        }

        public static Dish GetDish(string dishId)
        {
            return MyDAO2.GetDish(dishId);
        }

        public static void AddDish(Dish dish)
        {
            MyDAO2.AddDish(dish);
        }

        public static void UpdateDish(Dish dish)
        {
            MyDAO2.UpdateDish(dish);
        }

        public static void RemoveDish(string dishId)
        {
            MyDAO2.RemoveDish(dishId);
        }
        #endregion

        #region OrderOM
        public static IList<IDictionary<string, string>> ListOrderByGroupType(GroupType type, string staffId)
        {
            return MyDAO2.ListOrderByGroupType(type, staffId);
        }

        public static IList<IDictionary<string, string>> ListOrdersViaShop()
        {
            return MyDAO2.ListOrdersViaShop();
        }

        public static IList<IDictionary<string, string>> ListOrdersViaDish(string shopId)
        {
            return MyDAO2.ListOrdersViaDish(shopId);
        }

        public static IList<IDictionary<string, string>> ListOrdersViaStaff(string dishId)
        {
            return MyDAO2.ListOrdersViaDish(dishId);
        }

        public static void AddOrder(Order order)
        {
            MyDAO2.AddOrder(order);
        }
        #endregion

        #region FriendOM

        public static bool isFriend(string staffId, string friendId)
        {
            return MyDAO2.isFriend(staffId, friendId);
        }

        public static int addOrRemoveFriend(string staffId, string friendId)
        {
            if (MyDAO2.isFriend(staffId, friendId))
            {
                MyDAO2.removeFriend(staffId, friendId);
                return (int)IsFriend.No;
            }
            else
            {
                OrderBoardDao.AddFriend(staffId, friendId);
                return (int)IsFriend.Yes;
            }
        }

        #endregion

    }
}
